Imports System.Data.SqlClient

Public Class AddMember
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents lbl1 As System.Web.UI.WebControls.Label
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents editphonehome As System.Web.UI.WebControls.TextBox
    Protected WithEvents editphonework As System.Web.UI.WebControls.TextBox
    Protected WithEvents editfaxhome As System.Web.UI.WebControls.TextBox
    Protected WithEvents editfaxwork As System.Web.UI.WebControls.TextBox
    Protected WithEvents editemail As System.Web.UI.WebControls.TextBox
    Protected WithEvents editaddress1 As System.Web.UI.WebControls.TextBox
    Protected WithEvents editaddress2 As System.Web.UI.WebControls.TextBox
    Protected WithEvents editcity As System.Web.UI.WebControls.TextBox
    Protected WithEvents editprovince As System.Web.UI.WebControls.TextBox
    Protected WithEvents editpostalcode As System.Web.UI.WebControls.TextBox
    Protected WithEvents btnSave As System.Web.UI.WebControls.Button
    Protected WithEvents btnCancel As System.Web.UI.WebControls.Button
    Protected WithEvents EditFirstName As System.Web.UI.WebControls.TextBox
    Protected WithEvents EditLastName As System.Web.UI.WebControls.TextBox

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Response.Redirect("")
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim strFullName, strFirstName, strLastName, strAddress1, strAddress2 As String
        Dim strCity, strProvince, strPostalCode, strEmail As String
        Dim strPhoneHome, strPhoneWork, strFaxHome, strFaxWork As String

        Dim conPubs As SqlConnection
        Dim cmdSelect As SqlCommand
        Dim strSQL As String

        strFirstName = EditFirstName.Text
        strLastName = EditLastName.Text
        strAddress1 = editaddress1.Text
        strAddress2 = editaddress2.Text
        strCity = editcity.Text
        strProvince = editprovince.Text
        strPostalCode = editpostalcode.Text
        strEmail = editemail.Text
        strPhoneHome = editphonehome.Text
        strPhoneWork = editphonework.Text
        strFaxHome = editfaxhome.Text
        strFaxWork = editfaxwork.Text
        strFullName = strFirstName & " " & strLastName

        strSQL = "insert into members_committee " & _
            "(FullName, firstname, lastname, address_1, address_2, city, province, postal_code, " & _
            "phone_home, phone_work, fax_home, fax_work, email) Values " & _
            "('" & strFullName & "', '" & strFirstName & "', '" & strLastName & "', '" & strAddress1 & "', '" & _
            strAddress2 & "', '" & _
            strCity & "', '" & strProvince & "', '" & strPostalCode & "', '" & _
            strPhoneHome & "', '" & strPhoneWork & "', '" & strFaxHome & "', '" & _
            strFaxWork & "', '" & strEmail & "')"


        conPubs = New SqlConnection(ConfigurationManager.AppSettings.Item("SQLConnectionString"))
        cmdSelect = New SqlCommand(strSQL, conPubs)
        conPubs.Open()
        cmdSelect.ExecuteNonQuery()
        conPubs.Close()

        Response.Redirect("default.aspx")

    End Sub
End Class
